package com.itheima.facade;

/**
 * @author zzw
 * @date 2025/10/19
 * @description 智能音箱（外观角色）
 */
public class SmartAppliancesFacade {

    private final Light light;
    private final TV tv;
    private final AirCondition airCondition;

    public SmartAppliancesFacade() {
        light = new Light();
        tv = new TV();
        airCondition = new AirCondition();
    }

    public void say(String message) {
        if (message.contains("打开")) {
            on();
        } else if (message.contains("关闭")) {
            off();
        } else {
            System.out.println("我听不懂你说的！！！");
        }
    }

    // 一键开启电器
    private void on() {
        System.out.println("起床嘞");
        light.on();
        tv.on();
        airCondition.on();
    }

    // 一键关闭电器
    private void off() {
        System.out.println("睡觉了");
        light.off();
        tv.off();
        airCondition.off();
    }
}
